#include <iostream>

#include <stdio.h>

using namespace std;

int main()
{
    int shu[6];
    double ans;
    int i, n;
    
    scanf("%d", &n);
    while (n-->0)
    {
        for (i=1; i<=4; i++)
        	scanf("%d", shu+i);
       	if ( shu[2]-shu[1] == shu[3] - shu[2] && shu[3]-shu[2]== shu[4]- shu[3])
       	{
       	 	ans = shu [4] + shu[4] - shu[3];   
       	}    
       	else 
       	{
       	    ans = shu[4] * shu[4]*1.0 / shu[3];
       	}    
       	for (i=1; i<5; ++i)
        	 printf("%d ", shu[i]);
       	printf("%.0lf\n", ans);
       
    }    
    
    
}    